<?php 
class Com_TaobaoAnalyzer extends SiteAnalyzer
{
    protected $url = '';
    public function __construct($url)
    {
        $this->url = $url;
        $this->site = Sites::model()->findByPk(2);
    }

    public function get_site_charset()
    {
        return 'GBK';
    }

    public function get_item_id()
    {
        if(preg_match('@/item\.htm\?id=(\d+)@i', $this->url ,$match))
            return $match[1];
        return '';
    }

    public function get_item_title()
    {
        if(preg_match('@<h3><span class="tb-double-tag"></span>(.+?)</h3>@is', $this->get_page_content() ,$match))
            return $match[1];
        return '';
    }

    public function get_item_intro()
    {
        return '';
    }

    public function get_item_price()
    {
        if(preg_match('@<em class="tb-rmb-num">(\d+\.\d+).*?</em>@', $this->get_page_content() ,$match))
            return floatval($match[1]);
        return 0;
    }

    public function get_item_imgs()
    {
        return null;
    }
}